function [ result ] = FrameProcess( frame )
%FRAMEPROCESS Summary of this function goes here
%   Detailed explanation goes here


temp = [];
switch frame(2)
    case 2
        % Raw sensor data in real
        % |'$'|2|36|AX:4Bs|AY:4Bs|AZ:4Bs|GX:4Bs|GY:4Bs|GZ:4Bs|MX:4Bs|MY:4Bs|MZ:4Bs|[CRC]|'\n'|
        if ( (length(frame) == 40) && (frame(3) == 36) && (frame(40) == 10) )
            for j = 0:8
                i = 4*j + 4;
                d = frame(i)*2^24 + frame(i+1)*2^16 + frame(i+2) * 2^8 + frame(i+3);
                h = dec2hex(d,8);
                temp = [ temp hex2num(quantizer('single'),h)];
            end
            % Real data: 9dof value
            % |2|r_ax|r_ay|r_az|r_gx|r_gy|r_gz|r_mx|r_my|r_mz|: 10 bytes
            temp = [2 temp]; 
        end
        
    otherwise
        disp('Invalid message');
end

result = temp;


end

